﻿namespace JanusLibAing
{
    using System;
    using System.Windows.Forms;

    /// <summary>
    /// Auto Wait cursor
    /// write creating in using block
    /// </summary>
    public class WaitCursor : IDisposable
    {
        private Cursor prevCursor;

        /// <summary>
        /// Initializes a new instance of the <see cref="WaitCursor"/> class.
        /// </summary>
        /// <param name="control">The control.</param>
        public WaitCursor()
        {
            prevCursor = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;
        }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            {
                Cursor.Current = prevCursor;
            }
        }
    }
}
